package com.shawn.function;

import java.util.function.Predicate;

/**
 * Predicate demo
 * @author shawn
 */
public class PredicateDemo {

	public static void main(String[] args) {
		Predicate<String> predicate = new Predicate<String>() {
			@Override
			public boolean test(String o) {
				return o.isEmpty();
			}
		};
		System.out.println("匿名内部类方式： " + predicate.test("hello,world"));

		Predicate<String> func2 = s ->{
			return s.isEmpty();
		};
		System.out.println("lambda expression方式： " + func2.test("hello,world"));

		func2 = s ->{
			return s.isEmpty();
		};
		System.out.println("lambda expression方式： " + func2.test(""));
	}

}
